package service

import (
	"context"
	"ginfwk/application/dto"
	"ginfwk/application/dto/assembler"
	"ginfwk/domain/model/entity"
	"ginfwk/domain/service"
	"ginfwk/framework/base"
)

type AppUserService struct {
	base.Context

	service.UserService

	userAssembler *assembler.UserAssembler
}

func (s *AppUserService) InitContext(ctx context.Context) {
	s.Context.InitContext(ctx)
	s.UserService.InitContext(ctx)
}

func (u *AppUserService) GetUserInfo(id int) *dto.UserDTO {
	user := u.UserService.GetUserInfo(id)

	return u.userAssembler.ToUserDTO(user)
}

func (u *AppUserService) GetUserList(ids []int) []*dto.UserDTO {
	var users []*entity.UserEntity
	users = u.UserService.GetUserList(ids)

	return u.userAssembler.ToUserDTOList(users)
}
